# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=dum
pkgver=0.1.19
pkgrel=0
pkgdesc="An npm scripts runner written in Rust"
url="https://github.com/egoist/dum"
arch="aarch64 armhf armv7 ppc64le x86 x86_64"  # blocked by rust/cargo
license="MIT"
makedepends="cargo"
source="https://github.com/egoist/dum/archive/v$pkgver/dum-$pkgver.tar.gz
	strip-env_logger-features.patch
	"

prepare() {
	default_prepare

	# Optimize binary for size.
	cat >> Cargo.toml <<-EOF

		[profile.release]
		codegen-units = 1
		lto = true
		opt-level = "s"
		panic = "abort"
	EOF

	# No --locked, we have to update lockfile after patching Cargo.toml.
	cargo fetch
}

build() {
	cargo build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	install -D -m755 target/release/dum -t "$pkgdir"/usr/bin/
}

sha512sums="
ea86635c77a9cc369c3f0d8aa1c3bba3227f2a3132accccaaba4ccadaba9d2231ac149921bb70ba657878e2f6873a78b2cfaf5b4fb1476ebde5ad5b3b8264a3f  dum-0.1.19.tar.gz
d1834967fc1763723ced5d6ac9c158330daea610780feb91f4d50527040407dedff65f469f7906868172a9e877ae4ad3f2eb547c2f1cd0b305e35c3c36c118f6  strip-env_logger-features.patch
"
